use hello_macro::StringFormat;
use chrono::{NaiveDateTime, DateTime, Local};
use std::collections::HashMap;
use serde::Deserialize;

#[derive(StringFormat, Debug, Deserialize)]
struct Hong {
    #[field(skip)]
    a: i32,
    b: i32,
    c: Vec<i32>,
    #[field(date_format = "%Y-%m-%d")]
    d: NaiveDateTime,
    e: String,
    f: Option<Vec<NaiveDateTime>>,
    g: Option<i32>,
    h: Option<NaiveDateTime>,
}

#[derive(StringFormat, Debug, Deserialize)]
struct Wei {
    a: String,
    b: String,
}


fn main() {    
    let dt: DateTime<Local> = Local::now();
    let f = Some(vec![dt.naive_local()]);
    let h = Hong { a: 11, b: 10, c: vec![1], d: dt.naive_local(), e: "aa".into(), f, g: None, h: None};
    println!("{:?}", h);
    println!("{}", h.to_string());

    let s = "Hello|World!";
    let w = Wei::new_with_string(s.to_string());
    println!("{:?}", w);
}